from django.contrib import admin
from account.models import User, CustomerBankPointChangeLog, Sponsor, UserActivateApplication


# 用户管理
@admin.register(User)
class UserAdmin(admin.ModelAdmin):
    list_display = ['username', 'phone', 'real_name']
    ordering = ('username',)


# 管理员直接打钱给用户
@admin.register(CustomerBankPointChangeLog)
class CustomerBankPointChangeLogAdmin(admin.ModelAdmin):
    list_display = ['receiver', 'point_amount', 'remarks', 'add_time', 'operator', 'transaction_type']
    ordering = ('add_time', 'transaction_type')
    list_filter = ('receiver', 'operator', 'transaction_type')
    search_fields = ['remarks']


# 赞助
@admin.register(Sponsor)
class SponsorAdmin(admin.ModelAdmin):
    list_display = ['user', 'amount', 'add_time', 'remarks']
    ordering = ('-add_time',)
    list_filter = ('add_time',)
    search_fields = ['remarks']


# 用户申请激活
@admin.register(UserActivateApplication)
class UserActivateApplicationAdmin(admin.ModelAdmin):
    list_display = ['user', 'status', 'add_date',]
    ordering = ('-add_date',)
    list_filter = ('add_date',)
    search_fields = ['status']